﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace Sample_HttpRequest
{
    internal class Program
    {
        static void Main(string[] args)
        {

            string str = GetData("http://119.91.20.14/check/", Encoding.UTF8);

            Console.WriteLine(str);

            Console.ReadLine();


        }

        public static string GetData(string url, Encoding encoder)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "GET";
            request.ContentType = "text/html, application/xhtml+xml, */*";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream rs = response.GetResponseStream();
            StreamReader sr = new StreamReader(rs, encoder);
            var result = sr.ReadToEnd();
            sr.Close();
            rs.Close();
            return result;

        }
    }
}
